class Solution(object):
    def thirdMax(self, nums):
        """
        :type nums: List[int]
        :rtype: int
        """
        a = set(nums)
        if len(a) < 3:
            return max(a)

        m= list(sorted(a,reverse=True))
        return m[2]
